import {
  STORAGE_KEY_SYSTEM_INFO
} from '../consts'
function getQueryVariable(variable)
{
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
}
export function getSystemInfo() {
  let systemInfo = uni.getStorageSync(STORAGE_KEY_SYSTEM_INFO)
  if (!systemInfo) {
    systemInfo = uni.getSystemInfoSync()
    uni.setStorageSync(STORAGE_KEY_SYSTEM_INFO, systemInfo)
  }
  if(systemInfo.statusBarHeight===0){
	  systemInfo.statusBarHeight=getQueryVariable('height')||0
	  uni.setStorageSync(STORAGE_KEY_SYSTEM_INFO, systemInfo)
  }
  return systemInfo
}
